import 'reflect-metadata'
import { RequestHandler } from 'express'
export function use(middleware: RequestHandler) {
  // target 原型
  return function (target: any, key: string) {
    const originMiddleware = Reflect.getMetadata('middlewares', target) || []
    originMiddleware.push(middleware)
    Reflect.defineMetadata('middlewares', originMiddleware, target, key)
  }
}
